home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 02.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  5.2 KB  |  256 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Bubbles = strip(line)
  22. line = readln(TempFile)
  23. Speed = strip(line)
  24. line = readln(TempFile)
  25. MaxSize = strip(line)
  26. call close (TempFile)
  27. j=0
  28. TFrames = Frames
  29. if Field = 1 then TFrames = Frames*2
  30. do i = 1 to Frames
  31.     call open TempFile,"RAM:VFXNums",W
  32.     call writeln TempFile,right(i,5,'0')
  33.     call writeln TempFile,right(Frames,5,'0')
  34.     call close TempFile
  35.     f=0
  36.     Redraw Off
  37.     FieldSet = 0
  38.     if Padding ~= -1 & i = 1 then call PadIt(1)
  39.     call LoadB()
  40.     call LoadA()
  41.     j = j+ 1
  42.     call DoIt()
  43.     Redraw On
  44.     call SaveIt()
  45.         if Field = 1 then do
  46.             Redraw Off
  47.             FieldSet = 1
  48.             call LoadB()
  49.             call LoadA()
  50.             j = j + 1
  51.             call DoIt()
  52.             Redraw On
  53.             call SaveIt()
  54.             end 
  55.     if Padding ~= -1 & i = Frames then call PadIt(2)
  56.     end
  57.     if SaveType = 0 then do
  58.         if Padding = -1 then
  59.             call MakeIcon(SaveName,(Frames-10))
  60.         else
  61.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  62.         end
  63.     Undo On
  64. exit
  65.  
  66.  
  67. PadIt:
  68. arg PadNum
  69.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  70.         Undo On
  71.         exit
  72.         end
  73.          if PadNum = 1 then do
  74.        if IAType = 0 then do
  75.         do Pad = Padding to 1 by -1
  76.             LoadBuffer PicAName Force StartA-(Pad-1)
  77.             call Switcher(TOSW)
  78.             call Switcher(MDV1)
  79.             Render Go
  80.                 call RecordAdd(SaveName,2,6,Compression)
  81.             end
  82.         end
  83.        if IAType = 1 then do
  84.         LoadBuffer PicAName Force 1
  85.         call Switcher(TOSW)
  86.         call Switcher(MDV1)
  87.         Render Go
  88.             call RecordAdd(SaveName,2*Padding,6,Compression)
  89.         end
  90.        if IAType = 2 then do
  91.         LoadBuffer PicAName Force
  92.         call Switcher(TOSW)
  93.         call Switcher(MDV1)
  94.         Render Go
  95.             call RecordAdd(SaveName,2*Padding,6,Compression)
  96.         end
  97.        if IAType = 3 then do
  98.         do Pad = Padding to 1 by -1
  99.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  100.             call Switcher(TOSW)
  101.             call Switcher(MDV1)
  102.             Render Go
  103.                 call RecordAdd(SaveName,2,6,Compression)
  104.             end
  105.         end
  106.     end 
  107.     else do
  108.        if IBType = 0 then do
  109.         do Pad = 1 to Padding
  110.             LoadBuffer PicBName Force StartB+Pad+Frames
  111.             call Switcher(TOSW)
  112.             call Switcher(MDV1)
  113.             Render Go
  114.                 call RecordAdd(SaveName,2,6,Compression)
  115.             end
  116.         end
  117.        if IBType = 1 then do
  118.         LoadBuffer PicBName Force 1
  119.         call Switcher(TOSW)
  120.         call Switcher(MDV1)
  121.         Render Go
  122.             call RecordAdd(SaveName,2*Padding,6,Compression)
  123.         end
  124.        if IBType = 2 then do
  125.         LoadBuffer PicBName Force
  126.         call Switcher(TOSW)
  127.         call Switcher(MDV1)
  128.         Render Go
  129.             call RecordAdd(SaveName,2*Padding,6,Compression)
  130.         end
  131.        if IBType = 3 then do
  132.         do Pad = 1 to Padding
  133.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  134.             call Switcher(TOSW)
  135.             call Switcher(MDV1)
  136.             Render Go
  137.                 call RecordAdd(SaveName,2,6,Compression)
  138.             end
  139.         end
  140.     end
  141. return
  142.  
  143. LoadA:
  144.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  145.         Undo On
  146.         exit
  147.         end
  148.     if j = TFrames then return
  149.     if IAType = 0 then do
  150.         LoadBuffer PicAName Force i+StartA
  151.         end
  152.     if IAType = 1 then do
  153.         LoadBuffer PicAName Force 1
  154.         end
  155.     if IAType = 2 then do
  156.         LoadBuffer PicAName Force
  157.         end
  158.     if IAType = 3 then do
  159.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  160.         end
  161.  
  162. return
  163.  
  164. LoadB:
  165.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  166.         Undo On
  167.         exit
  168.         end
  169.     if j = 1 then return
  170.     if IBType = 0 then do
  171.         LoadBuffer PicBName Force i+StartB
  172.         end
  173.     if IBType = 1 then do
  174.         LoadBuffer PicBName Force 1
  175.         end
  176.     if IBType = 2 then do
  177.         LoadBuffer PicBName Force
  178.         end
  179.     if IBType = 3 then do
  180.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  181.         end
  182.     Swap
  183. return
  184.  
  185.  
  186. DoIt:
  187.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  188.         Undo On
  189.         exit
  190.         end
  191.     if j = TFrames then do
  192.         Swap
  193.         return
  194.         end
  195.     if j = 1 then return
  196.  
  197.     Num = (((j-1) * 100)/(TFrames-1))
  198.     Num = trunc(Num)
  199.     Hook Composite MERGE Num 1 0 0 MatchMain SwapScale
  200.  
  201.     Buffer2Swap
  202.     Hook Bubble j*Speed Bubbles 20 MaxSize '15' 6 6 '0' '-5' 360 60 10 100 100 Specular AntiAlias
  203.     Swap
  204.  
  205.     ByNum = 200
  206.     NewNum = ((j-1)*ByNum)/((TFrames/2)-1)
  207.     if j > (TFrames/2) then
  208.         NewNum = ((ByNum -(((j-1) * ByNum)/(TFrames-1)))%1)*2
  209.     NewNum = trunc(NewNum)
  210.     if NewNum > 100 then NewNum = 100
  211.     if NewNum = 100 then Swap
  212.     else Hook Composite MERGE NewNum 1 0 0 MatchMain
  213.  
  214. return
  215.  
  216. SaveIt:
  217.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  218.         Undo On
  219.         exit
  220.         end
  221.     if SaveType = 0 then do
  222.         call Switcher(TOSW)
  223.         call Switcher(MDV1)
  224.  
  225.         Render Go
  226.         if Field = 1 then
  227.                 call RecordAdd(SaveName,1,6,Compression)
  228.         else
  229.                 call RecordAdd(SaveName,2,6,Compression)
  230.         end
  231.  
  232.     if SaveType = 1 then do
  233.         if Field = 1 then do
  234.             f= f + 1
  235.             if f = 1 then
  236.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  237.             if f = 2 then do
  238.                 GetMain
  239.                 parse var result Name Width Height Blah
  240.                 Scale Width Height/2
  241.                 Swap
  242.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  243.                 Scale Width Height/2
  244.                 Hook Interlace
  245.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  246.                 f = 0
  247.                 end
  248.             end
  249.         else do
  250.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  251.             end    
  252.         end
  253. return
  254.  
  255.  
  256.